package dream.web;

import dream.service.ArticleService;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * 得到当前登录用户的信息
 */
@WebServlet("/upart")
public class UpdateServlet extends HttpServlet {
    private ArticleService articleService = new ArticleService();
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        this.doPost(request, response);
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String title = request.getParameter("title");
        String context = request.getParameter("context");
        String aid = request.getParameter("aid");

        articleService.UpdateByAid(title, context, Integer.valueOf(aid));

        response.getWriter().println("1");
    }
}
